package com.mioto.ld.module.alert.model;

import cn.hutool.json.JSONConfig;
import cn.hutool.json.JSONUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
 * @author mioto-qinxj
 * @date 2024/5/20
 * @desc 触发条件对象
 */
@Getter
@Setter
@ApiModel(value = "设备触发条件对象")
public class DeviceTriggerConditionDTO extends TriggerConditionDTO{

    @ApiModelProperty(value = "触发条件： > 为 1 >= 为 2 < 为 3 <= 为 4")
    private int condition;

    @ApiModelProperty(value = "触发值")
    private int targetValue;

    @Override
    public String toJsonStr(){
        JSONConfig jsonConfig = new JSONConfig();
        jsonConfig.setOrder(true);
        return JSONUtil.createObj(jsonConfig).set("condition",condition)
                .set("targetValue",targetValue).toString();
    }
}
